Previous Book Contents Book Index Next

Inside Macintosh: AppleScript Scripting Additions Guide /
Chapter 3 - Writing Scripting Additions / Types of Scripting Additions


Apple Event Coercions Scripting Addition

The 'osax' resource for an Apple event coercion scripting addition follows the following convention:
Resource type 'osax'
Resource IDAn identifier (for example, 3069)
Resource name'CSDSfromtoto' or 'CSPTfromtoto'

The letters CSDS or CSPT at the beginning of the resource name indicate that the scripting addition provides an Apple event coercion. CSDS indicates an Apple event coercion that uses the "from descriptor" interface. CSPT indicates an Apple event coercion that uses the "coerce from pointer" interface. The next eight characters of the resource name represent the "from" and "to" types.

The 'osax' code resource for scripting addition coercions is in the form
of Apple event coercion handler. The entry point for the code resource
must follow the Apple event coercion function interface for the particular coercion form.

In C, the "coerce from pointer" coercion form (CSPT) is

pascal OSErr MyCoercePtr (DescType fromType,
                          Ptr dataPtr,
                          Size dataSize,
                          DescType toType,
                          long theRefCon,
                          AEDesc *theResult);
In Pascal, the "coerce from pointer" coercion form (CSPT) is

FUNCTION MyCoercePtr (typeCode:DescType;
                      dataPtr: Ptr; 
                      dataSize: Size;
                      toType: DescType;
                      refcon: LongInt;
                      VAR addressDesc: AEDesc): OSErr;
In C, the "coerce from descriptor" coercion form (CSDS) is

pascal OSErr MyCoerceDesc (AEDesc theFromDesc,
                           DescType toType,
                           long theRefCon,
                           AEDesc *theResult);
In Pascal, the "coerce from descriptor" coercion form (CSDS) is

FUNCTION MyCoerceDesc (theFromDesc: AEDesc;
                       toType: DescType; 
                       theRefCon: LongInt; 
                       VAR addressDesc: AEDesc): OSErr;

Previous Book Contents Book Index Next

© Apple Computer, Inc.
18 DEC 1996